﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptBangCanDoiTaiKhoan : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonVi")]
        private ComboBox _CboDonVi;
        [AccessedThroughProperty("CKCapNhatLai")]
        private CheckBox _CKCapNhatLai;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("updNam")]
        private NumericUpDown _updNam;
        [AccessedThroughProperty("updThang")]
        private NumericUpDown _updThang;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;

        [DebuggerNonUserCode]
        public Frm_RptBangCanDoiTaiKhoan()
        {
            base.Load += new EventHandler(this.Frm_RptBangCanDoiTaiKhoan_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            string str = LVYModule.sRight("00" + Conversions.ToString(this.updThang.Value), 2) + "/" + LVYModule.sRight("0000" + this.updNam.Value.ToString(), 4);
            string str2 = DateTime.DaysInMonth(Convert.ToInt32(this.updNam.Value), Convert.ToInt32(this.updThang.Value)).ToString() + "/" + str;
            this.Cursor = Cursors.WaitCursor;
            if ((this.CKCapNhatLai.CheckState != CheckState.Checked) || this.UpdateData())
            {
                DataTable dataPrint = this.GetDataPrint();
                if (dataPrint.Rows.Count == 0)
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
                }
                else
                {
                    Rpt_BangCanDoiKeToan toan = new Rpt_BangCanDoiKeToan();
                    try
                    {
                        toan.SetDataSource(dataPrint);
                        if (modGeneral.H_LANGUAGE == "VIET")
                        {
                            toan.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                        }
                        else
                        {
                            toan.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                        }
                        toan.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                        toan.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                        toan.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                        toan.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                        toan.SetParameterValue(5, modGeneral.Tranlated("BẢNG C\x00c2N ĐỐI KẾ TO\x00c1N", ""));
                        toan.SetParameterValue(6, modGeneral.Tranlated("T\x00c0I SẢN", ""));
                        toan.SetParameterValue(7, modGeneral.Tranlated("M\x00e3 số", ""));
                        toan.SetParameterValue(8, modGeneral.Tranlated("Thuyết minh", ""));
                        toan.SetParameterValue(9, modGeneral.Tranlated("Số cuối kỳ", ""));
                        toan.SetParameterValue(10, modGeneral.Tranlated("Số đầu năm", ""));
                        toan.SetParameterValue(11, modGeneral.Tranlated("Tại ng\x00e0y", "") + ":" + str2);
                        toan.SetParameterValue(12, modGeneral.Tranlated("Người lập phiếu", ""));
                        toan.SetParameterValue(13, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                        toan.SetParameterValue(14, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                        toan.SetParameterValue(15, modGeneral.Tranlated("Cấp,ng\x00e0y.....th\x00e1ng.....Năm......", ""));
                        if (modGeneral.H_PHIENBANQUYETDINH == "QD15")
                        {
                            toan.SetParameterValue(0x10, modGeneral.Tranlated("MẪU SỐ B01 - DN", ""));
                            toan.SetParameterValue(0x11, modGeneral.Tranlated("(Ban h\x00e0nh theo QĐ số 15/2006/QĐ-BTC\nng\x00e0y 20/03/2006 v\x00e0 sửa đổi bổ sung theo th\x00f4ng tư 244/2009/TT-BTC ng\x00e0y 31/12/2009 của Bộ trưởng Bộ T\x00e0i Ch\x00ednh)", ""));
                        }
                        else
                        {
                            toan.SetParameterValue(0x10, modGeneral.Tranlated("MẪU SỐ B01 - DNN", ""));
                            toan.SetParameterValue(0x11, modGeneral.Tranlated("(Ban h\x00e0nh theo QĐ số 48/2006/QĐ-BTC\nng\x00e0y 14/09/2006 của Bộ trưởng Bộ T\x00e0i Ch\x00ednh)", ""));
                        }
                        MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = toan;
                        MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                        MyProject.Forms.Frm_ViewReport.ShowDialog();
                        this.Cursor = Cursors.Default;
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        this.Cursor = Cursors.Default;
                        MessageBox.Show(exception.Message.ToString());
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_RptBangCanDoiTaiKhoan_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonVi.SelectedValue = modGeneral.H_CLIENT;
                this.updThang.Value = new decimal(DateAndTime.Today.Month);
                this.updNam.Value = new decimal(DateAndTime.Today.Year);
            }
        }

        public DataTable GetDataPrint()
        {
            DataTable table;
            string str = this.updNam.Value.ToString() + LVYModule.sRight("00" + this.updThang.Value.ToString(), 2);
            try
            {
                string commandText = " SELECT Loai as MaLoai,  PhanLoai = Case Rtrim(Loai) When 'TS' then N'T\x00c0I SẢN' When 'NV' then N'NGUỒN VỐN' End,  DienGiai, MaSo, ThuyetMinh, SoCuoiNam, SoDauNam, NamThang from BC_CanDoiKeToan  WHERE NamThang = '" + str + "' And KhoaDonVi = '" + LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() + "' ORDER BY MaSo";
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message);
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptBangCanDoiTaiKhoan));
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.GroupBox1 = new GroupBox();
            this.Label2 = new Label();
            this.updThang = new NumericUpDown();
            this.updNam = new NumericUpDown();
            this.Label13 = new Label();
            this.CKCapNhatLai = new CheckBox();
            this.Label1 = new Label();
            this.CboDonVi = new ComboBox();
            this.GroupBox1.SuspendLayout();
            this.updThang.BeginInit();
            this.updNam.BeginInit();
            this.SuspendLayout();
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            Point point = new Point(0x115, 0x7e);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            Size size = new Size(0x4f, 0x19);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x15;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xc2, 0x7e);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x19);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 20;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.GroupBox1.BackColor = Color.Transparent;
            this.GroupBox1.Controls.Add(this.Label2);
            this.GroupBox1.Controls.Add(this.updThang);
            this.GroupBox1.Controls.Add(this.updNam);
            this.GroupBox1.Controls.Add(this.Label13);
            this.GroupBox1.Controls.Add(this.CKCapNhatLai);
            this.GroupBox1.Controls.Add(this.Label1);
            this.GroupBox1.Controls.Add(this.CboDonVi);
            point = new Point(5, 5);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            size = new Size(0x15f, 0x73);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 0x13;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "T\x00f9y chọn";
            this.Label2.AutoSize = true;
            point = new Point(0x91, 0x38);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x1d, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x33;
            this.Label2.Text = "Năm";
            point = new Point(0x55, 0x36);
            this.updThang.Location = point;
            decimal num = new decimal(new int[] { 12, 0, 0, 0 });
            this.updThang.Maximum = num;
            num = new decimal(new int[] { 1, 0, 0, 0 });
            this.updThang.Minimum = num;
            this.updThang.Name = "updThang";
            size = new Size(0x26, 20);
            this.updThang.Size = size;
            this.updThang.TabIndex = 50;
            num = new decimal(new int[] { 1, 0, 0, 0 });
            this.updThang.Value = num;
            point = new Point(0xcc, 0x36);
            this.updNam.Location = point;
            num = new decimal(new int[] { 0x9c4, 0, 0, 0 });
            this.updNam.Maximum = num;
            num = new decimal(new int[] { 0x7d7, 0, 0, 0 });
            this.updNam.Minimum = num;
            this.updNam.Name = "updNam";
            size = new Size(50, 20);
            this.updNam.Size = size;
            this.updNam.TabIndex = 0x31;
            num = new decimal(new int[] { 0x7d7, 0, 0, 0 });
            this.updNam.Value = num;
            this.Label13.AutoSize = true;
            point = new Point(0x12, 0x38);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x26, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x30;
            this.Label13.Text = "Th\x00e1ng";
            this.CKCapNhatLai.AutoSize = true;
            point = new Point(0x55, 0x56);
            this.CKCapNhatLai.Location = point;
            this.CKCapNhatLai.Name = "CKCapNhatLai";
            size = new Size(0x74, 0x11);
            this.CKCapNhatLai.Size = size;
            this.CKCapNhatLai.TabIndex = 0x2f;
            this.CKCapNhatLai.Text = "Cập nhật lại dữ liệu";
            this.CKCapNhatLai.UseVisualStyleBackColor = true;
            this.Label1.AutoSize = true;
            point = new Point(0x12, 0x1a);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x26, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 1;
            this.Label1.Text = "Đơn vị";
            this.CboDonVi.FormattingEnabled = true;
            point = new Point(0x55, 0x17);
            this.CboDonVi.Location = point;
            this.CboDonVi.Name = "CboDonVi";
            size = new Size(0xfc, 0x15);
            this.CboDonVi.Size = size;
            this.CboDonVi.TabIndex = 0;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x16a, 0x9d);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.CmdOK);
            this.Controls.Add(this.GroupBox1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptBangCanDoiTaiKhoan";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-0026             ";
            this.Text = "BANG CAN DOI TAI KHOAN";
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.updThang.EndInit();
            this.updNam.EndInit();
            this.ResumeLayout(false);
        }

        public bool UpdateData()
        {
            bool flag=false;
            IDataParameter[] commandParameters = new IDataParameter[4];
            string str = this.updNam.Value.ToString() + LVYModule.sRight("00" + Conversions.ToString(this.updThang.Value), 2);
            string str2 = Conversions.ToString(decimal.Subtract(this.updNam.Value, decimal.One)) + LVYModule.sRight("00" + Conversions.ToString(this.updThang.Value), 2);
            try
            {
                commandParameters[0] = DBHelper.createParameter("@NamThangTruoc", DbType.Int64, ParameterDirection.Input, str2);
                commandParameters[1] = DBHelper.createParameter("@NamThang", DbType.Int64, ParameterDirection.Input, str);
                commandParameters[2] = DBHelper.createParameter("@KhoaDonVi", DbType.Int64, ParameterDirection.Input, RuntimeHelpers.GetObjectValue(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.String)));
                commandParameters[3] = DBHelper.createParameter("@pError", DbType.Double, ParameterDirection.Output, 0);
                if (modGeneral.H_PHIENBANQUYETDINH == "QD15")
                {
                    DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "GL_BC_BangCanDoiKeToan_15", commandParameters);
                }
                else
                {
                    DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "GL_BC_BangCanDoiKeToan_48", commandParameters);
                }
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(commandParameters[3].Value, 0, false))
                {
                    return false;
                }
                flag = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                this.Cursor = Cursors.Default;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        internal virtual ComboBox CboDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonVi = value;
            }
        }

        internal virtual CheckBox CKCapNhatLai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CKCapNhatLai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CKCapNhatLai = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual NumericUpDown updNam
        {
            [DebuggerNonUserCode]
            get
            {
                return this._updNam;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._updNam = value;
            }
        }

        internal virtual NumericUpDown updThang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._updThang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._updThang = value;
            }
        }
    }
}

